package com.jianzong.lingxuan;

import com.jianzong.lingxuan.im.WebSocketNettyServer;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.util.ResourceUtils;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@SpringBootApplication
@MapperScan(basePackages = "com.jianzong.lingxuan.*.mapper")
@EnableCaching
public class LingxuanApplication extends WebMvcConfigurationSupport {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry){
        registry.addResourceHandler("**").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX + "/static/view/");
        super.addResourceHandlers(registry);
    }

    public static void main(String[] args) {
        SpringApplication.run(LingxuanApplication.class, args);
        WebSocketNettyServer.main(null);
    }

}
